//
//  RewardBaseManager.h
//  os-usrsrc_Example
//
//  Created by neil on 2019/7/18.
//  Copyright © 2019 neil. All rights reserved.
//

#import <Foundation/Foundation.h>

@class RewardBaseManager;
@protocol RewardCallBack <NSObject>
//无论成功或者失败都会在关闭时回调，
- (void)rewardVideoReward:(BOOL)rewardSuccess logMap:(NSDictionary *)logMap;
//接收到广告时的回调
- (void)rewardVideoReceive:(RewardBaseManager *)rewardManager;
//广告即将展示时的回调。
- (void)rewardVideoWillShow:(RewardBaseManager *)rewardManager;

@end

typedef enum : NSInteger {
    RewardFailErrorNetworkError = 100,
    RewardFailErrorNoFill,
} RewardFailError;

@interface RewardBaseManager : NSObject

@property(nonatomic, weak)id<RewardCallBack> delegate;
- (void)showRewardedVideoAd;
@property(nonatomic, assign)BOOL watchCompleted;//标记用户s是否看完视频说
@property(nonatomic, assign)NSUInteger lastReloadAdTime;//上次加载h时间
@property(nonatomic, assign)BOOL delayLoading;//是否正在延时加载中
@property(nonatomic, strong)NSMutableDictionary *logMap;
@property(nonatomic, strong)NSMutableDictionary *logErrorMap;
@property(nonatomic, assign)NSInteger reloadTimes;//重试次数
@property(nonatomic, assign)BOOL loadFailed;//标记加载失败过一次
@property(nonatomic, assign)BOOL failReasonNoNetwork;

//@property(nonatomic, assign)NSInteger adIdIndex;//视频s序号


//延时加载，并且判断间隔时间 > 60s 再进行加载
- (void)delayToLoad:(NSInteger)delay;
//showRewardVideo 时判断not ready 时，重试加载
- (void)notReadyTryLoad;
//正常重试加载视频
- (void)normalReload:(NSInteger)delay;

- (instancetype )initWithAdId:(NSString *)adId;
- (BOOL)isReady;
//- (BOOL)isReadyIfNoReLoadAd;
//收到网络的通知
- (void)netWorkReach;

/// 激励视频统一回调。
- (void)OSRewardedVideoAd:(RewardBaseManager *)rewardManager didFailWithOSError:(NSError *)osError originError:(NSError *)originError;
- (void)OSRewardedVideoAdDidLoad:(RewardBaseManager *)rewardManager;
- (void)OSRewardedVideoAdDidClick:(RewardBaseManager *)rewardManager;
- (void)OSRewardedVideoAdVideoComplete:(RewardBaseManager *)rewardManager;
- (void)OSRewardedVideoAdDidClose:(RewardBaseManager *)rewardManager;


@end

